package com.cykj.eurekaribbon.service.impl;

import com.cykj.eurekaribbon.bean.CityInfo;
import com.cykj.eurekaribbon.service.StationInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.loadbalancer.LoadBalancerClient;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import java.util.List;

@Service
public class StationInfoServiceImpl implements StationInfoService {

    @Autowired
    RestTemplate restTemplate;

    @Autowired
    LoadBalancerClient loadBalancer;

    /**
     * @version 1.0
     * @author: zhiMing
     * @date: 2021/9/23 1:00
     * @desc: service层，将获取站点数据的请求转发到后端
     */
    @Override
    public CityInfo getStationList(String district) {
        /*转发请求*/
        return restTemplate.getForObject("http://CLIENT/getStationList?district="+district,CityInfo.class);
    }
}
